<!DOCTYPE HTML>
<html>
<head>
<include file="Include:meta" />
<title>项目进展-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text"><if condition="$project['info_id'] neq NULL">商务跟进</if>项目 > [{$project['project_num']}]{$project['project_name']} > 项目进展</div>
	</div>
	<div id="content">
		<include file="Include:project_header" />
		<form method="post" name="number_validate" id="password_validate" novalidate="novalidate">
			<input type="hidden" name="action" value="add">
			<input type="hidden" name="pid" value="{$project['id']}">
			<div class="form-main">
				<div class="form-title">项目进展</div>
				<div class="form-table-item">
					<table class="table">
						<tbody>
							<tr class="form-table-header">
								<td width="35%">工作进展</td>
								<td width="35%">工作计划</td>
								<td width="15%">添加人(日期)</td>
								<if condition="((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)">
								<td width="5%">管理</td>
								</if>
							</tr>
							<if condition="$result eq NULL">
							<tr>
								<td class="text-center" <if condition="((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1) and ($project['gt_status'] neq 1)">colspan="4"<else/>colspan="3"</if>>暂无相关数据</td>
							</tr>
							</if>
							<foreach name="result" item="vo">
								<tr>
									<td>{$vo['progress']}</td>
									<td>{$vo['plan']}</td>
									<td>{$vo['add_user']}({$vo['add_date']|substr=0,10})</td>
									<if condition="((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)">
									<td><if condition="$key eq 0"><a href="javascript:;" mid="{$vo['id']}" action="delete" data-toggle="tooltip" data-placement="left" title="删除" class="delete ml5"><i class="glyphicon glyphicon-trash"></i></a></if></td>
									</if>
								</tr>
							</foreach>
						</tbody>
					</table>
				</div>
				<if condition="((((get_permission($qs,NULL,3)) and ($project['add_uid'] eq $login_id)) or (get_permission($qs,NULL,2) and (in_array($project['center_id'],$manage_id))) or (get_permission($qs,NULL,1))) or ($project['director_uid'] eq $login_id) or ($project['manager_uid'] eq $login_id)) and ($project['status'] eq 1)">
				<div class="form-title">添加项目进展</div>
				<div class="form-item">
					<div class="toggle-item clearfix">
						<div class="mb10 left" style="width:45%">
							<div class="input-label">工作进展</div>
							<div class="input-item">
								<textarea name="progress" class="form-control h100" style="width:90%" autocomplete="off"></textarea>
								<span class="error-item">必填项</span>
							</div>
						</div>
						<div class="mb10 left" style="width:45%">
							<div class="input-label">工作计划</div>
							<div class="input-item">
								<textarea name="plan" class="form-control h100" style="width:90%" autocomplete="off"></textarea>
								<span class="error-item">必填项</span>
							</div>
						</div>
					</div>
				</div>
				<div class="form-btn-item"><button class="btn submit" type="button">提交</button></div>
				</if>
			</div>
		</form>
	</div>
</div>
<include file="Include:javascript" />
<script>
$(function(){
	$(".delete").ajaxModal({"title_text":"删除提示框","body_text":"您确定要删除吗？","url":"__APP__/Project/project_progress_ajax","data":{"id":"mid","action":"action"}});
	//提交验证
	$(".submit").on('click',function(){
		var tag = true,
			pro = $("[name='progress']").val(),
			pal = $("[name='plan']").val();
		
		if(pro==""&&pal==""){
			defeated_alert("至少填写一项项目进展");
			tag = false;
		}
		if(/^\s+$/.test(pro)){
			$("[name='progress']").next(".error-item").show();
			tag = false;
		}
		if(/^\s+$/.test(pal)){
			$("[name='plan']").next(".error-item").show();
			tag = false;
		}
		// || 
		if(tag){
			var communicate_add = 'communicate_add',
				pid = "{$project['id']}";
			$.ajax({
				type:"POST",
				async:false,
				dataType:"json",
				data:$("[name='number_validate']").serialize(),
				url:"__APP__/Project/project_progress_ajax",
				success:function(data){
					success_pop(data.status,data.msg);
				}
			});    
		}
	});
	//隐藏错误提示
	$("[name='progress'],[name='plan']").focus(function(){
		$(this).nextAll(".error-item").hide();
	});
})
</script>
</body>
</html>